<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<input id="txt" type="text" />
		<input type="button" id="del" value="删除li" />
		<input type="button" id="add" value="创建li" />
		<ul id="ul">	</ul>
		<script >
			var txt=document.getElementById('txt');
			var del=document.getElementById('del');
			var add=document.getElementById('add');
			var ul=document.getElementById('ul');
			add.onclick=function () {
				var li=document.createElement('li');
			li.innerHTML=txt.value;
			//把h1元素增加到页面
			ul.appendChild(li);
			
			};
			del.onclick=function () {
				ul.lastElementChild.remove();
			};
		</script>
	</body>
</html>
